class TimeUtil {
	public constructor() {
	}

	public static getTimeStamp():number{
		let date:Date = new Date();
		return Math.floor(date.getTime()/1000);
	}

	public static getIsNight()
	{
		let now = new Date(),hour = now.getHours();
		if((hour >=0 && hour < 6) || hour >= 18)
		{
			return true;
		}
		else
		{
			return false;
		}
	}

	/**
	 * 判断是否在某个时间段内
	 * parma
	 */
	public static judgeIsInTimeRange(beginTime:string, endTime:string)
	{
		let strb = beginTime.split (":");
		if (strb.length != 2) {
			return false;
		}
		
		let stre = endTime.split (":");
		if (stre.length != 2) {
			return false;
		}
		
		let b = new Date ();
		let e = new Date ();
		let n = new Date ();
		
		b.setHours (parseInt(strb[0]));
		b.setMinutes (parseInt(strb[1]));
		e.setHours (parseInt(stre[0]));
		e.setMinutes (parseInt(stre[1]));
		
		if (n.getTime () - b.getTime () > 0 && n.getTime () - e.getTime () < 0) {
			return true;
		} else {
			return false;
		}
	}
}